package com.team.controller;

import com.team.util.UploadUtil;
import com.team.vo.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * -*- coding:utf-8 -*-
 *
 * @author 太阳偷渡青山
 * @software IntelliJ IDEA
 * @date 2022/09/28 22:04
 * @Description
 */
@Controller
@RequestMapping("/upload")
public class UploadController {
    /**
     * 添加用户的头像上传远程
     *
     * @param file 文件
     * @return {@link Result}
     */
    @RequestMapping("/sure")
    @ResponseBody
    public Result upload( MultipartFile file){
        String url = UploadUtil.uploadOOS(file);
        return new Result(200,"上传成功",url);
    }

}